﻿using DataTransfer.Core.Services;
using DataTransfer.SDK.Models;

namespace DataTransfer.Core.Domains
{
    public class ExcelExporter : IExcelExporter
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public string DataLoaderTypeName
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public Type DataLoaderType
        {
            get
            {
                var typeName = this.DataLoaderTypeName;
                if (string.IsNullOrEmpty(typeName))
                {
                    return typeof(DefaultDataLoader);
                }
                Type loaderType = Type.GetType(this.DataLoaderTypeName, true, true);
                return loaderType;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public ExcelFormat ExcelFormat
        {
            get;
            set;
        } = ExcelFormat.XLS;

        /// <summary>
        /// 
        /// </summary>
        public int MaxRowCountPerSheet
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<IExcelExportSheet>  Sheets
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public IDictionary<string, Type> Modules
        {
            get;
            set;
        }

    }
}
